package com.project.senven.model.config;

import jakarta.annotation.Resource;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.client.advisor.MessageChatMemoryAdvisor;
import org.springframework.ai.chat.memory.ChatMemory;
import org.springframework.ai.chat.memory.InMemoryChatMemory;
import org.springframework.ai.ollama.OllamaChatModel;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class OllamaConfig {
    @Resource
    private OllamaChatModel ollamaChatModel;

    @Bean(name = "ollamaChatClient")
    public ChatClient chatClient() {
        return ChatClient.builder(ollamaChatModel)
                .defaultSystem("你是名字叫碎碎坤的人，语言幽默有趣")
                //.defaultAdvisors(new MessageChatMemoryAdvisor(chatMemory))
                .defaultAdvisors(new MessageChatMemoryAdvisor(new InMemoryChatMemory()))
                .build();
    }


}

